<extend name="./Common/View/Public/list.html" />

<block name="page_title">部门列表</block>
<block name="search">
    <div class="layui-input-inline">
        <select name="pid" id="pid" lay-filter="pid" tree="base/Department/tree/status/1" empty="上级部门"></select>
    </div>
    <div class="layui-input-inline">
        <select name="type" id="type" lay-filter="depart_id" api="sys/Dict/info/code/DEPARTMENT_TYPE" empty="部门类型"></select>
    </div>
    <div class="layui-input-inline">
        <select name="status" id="status" lay-filter="status" api="sys/Dict/info/code/STATUS" empty="状态"></select>
    </div>
    <div class="layui-input-inline">
        <input class="layui-input" name="keywords" autocomplete="off" placeholder="部门名称" />
    </div>
</block>
<block name="toolbar">
    {:W('Todo/UI/toolbar',array('部门',array('add','delete','enable','disable','imports','exports')))}
</block>
<block name="main">
    <script type="text/javascript">
        var list = {api:"{$Think.const.MODULE_NAME}/{$Think.const.CONTROLLER_NAME}/"};
        list.columns =  [[
            {checkbox: true, fixed: true}
            , {field:'title', minWidth:100, title : '部门名称'}
            , {field:'pid', minWidth:100, title : '上级部门', templet: '#tpl_parent'}
            , {field:'app_id', minWidth:150, title : '部门类型', sort: true, templet: '#tpl_type'}
            , {field: 'status', title: '状态', width: 80, sort: true, templet: '#tpl_status'}
            , {field: 'sort', title: '排序', width: 80, sort: true}
            ,{fixed: 'right', minWidth:100, align:'center', toolbar: '#tpl_bar'}
        ]];
    </script>
    <script type="text/html" id="tpl_bar">
        {{ format_optbar(['edit','delete']) }}
    </script>
    <script type="text/html" id="tpl_type">
        {{ format_department_type(d.type) }}
    </script>
    <script type="text/html" id="tpl_parent">
        {{ format_data_department(d.pid) }}
    </script>
    <script type="text/html" id="tpl_status">
        {{ format_status(d.status) }}
    </script>
</block>
<block name="script">
    <script src="/api/Base/Department/format"></script>
</block>